<template>
  <div class="recordDetail">
    <Navbar :appTitle="title" />
    <!--头部-->
    <div class="d-head">
      <div class="content" style="display:block">
        <div class="left">
          <div class="title">
            {{ detailInfo.orderCode }}
          </div>
          <div class="row">
            <span class="r-label">生产物料：</span>
            <span class="r-column">{{ detailInfo.goodsFullName }}</span>
          </div>
          <div class="row">
            <span class="r-label">规格：</span>
            <span class="r-column">{{ detailInfo.spec }}</span>
          </div>
          <div class="row">
            <span class="r-label">基本单位：</span>
            <span class="r-column">{{ detailInfo.basicUnitText }}</span>
          </div>
          <div class="row">
            <span class="r-label">工序：</span>
            <span class="r-column">{{ detailInfo.processCode }}</span>
          </div>
          <div class="row">
            <span class="r-label">处理方式：</span>
            <span class="r-column">{{ detailInfo.handleTypeText }}</span>
          </div>
            <div class="row">
            <span class="r-label">不合格工序：</span>
            <span class="r-column">{{ detailInfo.failedProcessName }}</span>
          </div>
            <div class="row">
            <span class="r-label">不合格操作人：</span>
            <span class="r-column">{{ detailInfo.failedOperatorName }}</span>
          </div>
        </div>
      </div>
    </div>
    <div class="others">
      <div class="otherTaps">
        <div class="title">
          <span class="icon"></span>
          <span class="content">执行信息</span>
        </div>
        <div class="content">
          <div class="row">
            <span class="r-label">批次编号：</span>
            <span class="r-column"><batch-production :code="detailInfo.batchCode" :id="detailInfo.batchId"></batch-production></span>
          </div>
          <div class="row">
            <span class="r-label">处理数量：</span>
            <span class="r-column">{{ commafy(detailInfo.num) }} {{ detailInfo.reportWorkUnitText}}</span>
          </div>
          <div class="row" v-if="handleType == 'repair'">
            <span class="r-label">返修工序：</span>
            <span class="r-column">{{ detailInfo.processCode }}</span>
          </div>
          <div class="row" v-if="handleType == 'repair'">
            <span class="r-label">返修量：</span>
            <span class="r-column">{{ commafy(detailInfo.repairNum) }}{{ detailInfo.repairReportWorkUnitText }}</span>
          </div>
          <div class="row">
            <span class="r-label">执行人：</span>
            <span class="r-column">{{ detailInfo.executorIdText }}</span>
          </div>
          <div class="row">
            <span class="r-label">执行时间：</span>
            <span class="r-column">{{ detailInfo.executeTime }}</span>
          </div>
        </div>
      </div>
      <div class="otherTaps" v-if="handleType != 'compromise'">
        <div class="title">
          <span class="icon"></span>
          <span class="content">其它</span>
        </div>
        <div class="content">
          <div class="row">
            <span class="r-label">备注：</span>
            <span class="r-column"
              >{{ detailInfo.remark }}</span
            >
          </div>
          <div class="row">
            <span class="r-label">附件：</span>
            <span class="r-column" v-if="detailInfo.attachment">
              <upload
                class="fileclass"
                iconType="fj"
                :fileIds="detailInfo.attachment"
                :showUpload="false"
              ></upload>
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Navbar from "@/components/navBar/navBar_right";
import upload from "@/components/upload/upload";
import { messNotQualityHandleIinfoDetailQueryInfoById } from '@/api/system'
import { commafy } from '@/utils/util'
import BatchProduction from '@/components/BatchProduction'
export default {
  name: "recordDetail",
  components: { Navbar, upload, BatchProduction },
  data() {
    return {
      title: '',
      handleType: '',
      detailInfo: {},
      commafy,
    };
  },
  computed: {},
  mounted() {
  },
  created() {
    this.getDetail()
  },
  methods: {
    /* 获取详情 */
    getDetail() {
      let id = ''
      this.handleType = this.$route.query.handleType
      let requestApi = messNotQualityHandleIinfoDetailQueryInfoById
      if (this.$route.query.scrapApplyId) {
        // 从出入库进入
        // id = this.$route.query.scrapApplyId
        // requestApi = messScrapInboundApplyQueryInfoByScrapApplyId
      } else {
        id = this.$route.query.id
      }
      requestApi(id).then(res => {
        if (res.code == 200) {
          this.detailInfo = res.result
          console.log('this.detailInfo',this.detailInfo);
          if (this.detailInfo.handleType == 'scrap') {
            this.title = '报废入库详情'
          } else if (this.detailInfo.handleType == 'repair') {
            this.title = '发起返修详情'
          } else if (this.detailInfo.handleType == 'compromise') {
            this.title = '让步接收详情'
          } else {
            return
          }
        }
      })
    },
  },
};
</script>
<style lang="scss" scoped>
.recordDetail {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  .others {
    flex: 1;
    overflow-y: scroll;
  }
  // overflow-y: scroll;
  .d-head {
    width: 100%;
    padding: 0.16rem 0.16rem 0.16rem 0.16rem;
    background: #ffffff;
    z-index: 999;
    .content {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .left {
        width: 2.8rem;
        // border: 1px solid red;
        .title {
          font-size: 0.16rem;
          font-family: PingFang SC;
          font-weight: 500;
          color: #191f25;
          line-height: 0.22rem;

          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          -o-text-overflow: ellipsis;
        }
        .row {
          font-size: 0.14rem;
          font-family: PingFang SC;
          font-weight: 400;
          color: #888888;
          margin-top: 0.16rem;
        }
      }
      .right {
        // border: 1px solid red;
        width: 0.6rem;
        .rightImg {
          display: block;
          width: 0.55rem;
          height: 0.55rem;
          //   margin-left: 0.45rem;
          // border: 1px solid blue;
        }
      }
    }
  }

  .otherTaps {
    background: #ffffff;
    padding: 0.16rem;
    margin-top: 0.1rem;
    .title {
      padding-bottom: 0.1rem;
      border-bottom: 1px solid #eeeeee;
      .icon {
        display: inline-block;
        width: 0.03rem;
        height: 0.14rem;
        background: #1890ff;
      }
      .content {
        width: 0.63rem;
        height: 0.16rem;
        font-size: 0.16rem;
        font-family: PingFang SC;
        font-weight: bold;
        color: #191f25;
        line-height: 0.22rem;
        margin-left: 0.1rem;
      }
    }
    .content {
      .row {
        font-size: 0.14rem;
        font-family: PingFang SC;
        font-weight: 400;
        margin-top: 0.16rem;
        display: flex;
        .r-label {
          color: #888888;
          display: block;
          width: 0.7rem;
          //   border: 1px solid red;
        }
        .r-column {
          display: block;
          color: #191f25;
          width: 2.5rem;
          //   border: 1px solid red;
          //    width: 1rem;
        }
      }
      .fhrow {
        display: flex;
        .fhImg {
          width: 0.55rem;
          height: 0.55rem;
          border-radius: 0.1rem;
        }
        .rt-column {
            width: 2.55rem;
        //   height: 2.55rem;
          margin-left: 0.2rem;
          .rt-title {
            font-size: 0.16rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: #191f25;
            margin-bottom: 0.16rem;
          }
          .rt-row {
            display: flex;
            justify-content: space-between;
            margin-bottom: 0.23rem;
            .column {
            //    border: 1px solid red;
               width: 1.5rem;
              .column-t {
                font-size: 0.14rem;
                font-family: PingFang SC;
                font-weight: 400;
                color: #888888;
                display: block;
                width: 100%;
                margin-bottom: 0.03rem;
                
              }
              .column-c {
                font-size: 0.16rem;
                font-family: PingFang SC;
                font-weight: 400;
                color: #191f25;
                display: block;
                width: 100%;
              }
            }
          }
        }
      }
    }
  }
  .search-bottom {
    height: 0.5rem;
    width: 100%;
    background: #ffffff;
    // background: red;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0px;
    padding: 0.11rem;
    .btnconfirm {
      width: 1.72rem;
      height: 0.39rem;
      background: #1890ff;
      border-radius: 0rem;
      text-align: center;
      line-height: 0.39rem;
    }
    .btncancel {
      width: 1.72rem;
      height: 0.39rem;
      background: #f6f6f6;
      border: 0.01px solid rgba(25, 31, 37, 0.12);
      border-radius: 0rem;
      text-align: center;
      line-height: 0.39rem;
    }
  }
}
</style>
<style>